package com.gyg.controller;

import com.gyg.client.CloudVideoClient;
import com.gyg.domain.CloudUser;
import com.gyg.enums.SessionEnum;
import com.gyg.returns.RespEntity;
import com.gyg.returns.RespTable;
import com.gyg.utils.OSSUtil;
import com.gyg.vo.param.BanParam;
import com.gyg.vo.param.UpdateFileParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

@Slf4j
@RestController
@Api(value = "视频模块", tags = "视频模块")
@RequestMapping("/cloud-video")
public class CloudVideoController {

    @Resource
    private OSSUtil ossUtil;

    @Resource
    private CloudVideoClient cloudVideoClient;

    @ApiOperation(value = "视频列表")
    @GetMapping("/list")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "page", value = "当前页数", required = true),
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "limit", value = "每页数量", required = true),
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "ban", value = "封禁标识", required = true),
            @ApiImplicitParam(paramType = "query", dataType = "String", name = "username", value = "用户账号", required = true),
    })
    public RespTable cloudVideoList(@RequestParam(value = "page", required = true) Integer page,
                                     @RequestParam(value = "limit", required = true) Integer limit,
                                     @RequestParam(value = "ban", required = true) Integer ban,
                                     @RequestParam(value = "username", required = false) String username) {
        RespTable respTable = cloudVideoClient.cloudVideoList(page, limit, ban, username);
        return respTable;
    }

    @PutMapping("/ban")
    @ApiOperation(value = "封禁视频")
    public RespEntity banAudio(BanParam banParam) {
        RespEntity respEntity = cloudVideoClient.banVideo(banParam);
        return respEntity;
    }

    @PutMapping("/unseal")
    @ApiOperation(value = "解封视频")
    public RespEntity unsealAudio(BanParam banParam) {
        RespEntity respEntity = cloudVideoClient.unsealVideo(banParam);
        return respEntity;
    }

}
